const express = require('express');
const mysql = require('mysql');
const pool = mysql.createPool({
	host: '127.0.0.1',
	port: '3306',
	user: 'root',
	password: '',
	database: 'tedu',
	connectionLimit: 15
})
const app = express();
app.listen(3000);

app.use(express.urlencoded({
	extended: false
}))
app.delete('/v1/emps/:eid', (req, res) => {
	//console.log(req.params);
	pool.query('delete from emp where eid=?', [req.params.eid], (err, result) => {
		if (err) throw err;
		//console.log(result);
		if (result.affectedRows == 1) {
			res.send({code: 200,msg: '删除成功'})
		}else{
			res.send({code:201,msg:'删除失败'})
		}
	})

})
